 <html>
    <head>
      <title>A Demo Page</title>
      <meta charset="UTF-8">
      <script src="./qwebchannel.js"></script>
      <script language="javascript">
        function completeAndReturnName() {
          var fname = document.getElementById('fname').value;
          var lname = document.getElementById('lname').value;
          var full = fname + ' ' + lname;

          document.getElementById('fullname').value = full;
          document.getElementById('submit-btn').style.display = 'block';

          return full;
        }
                      
        document.addEventListener("DOMContentLoaded", function () {
                 	
        	new QWebChannel( qt.webChannelTransport, function(channel) {
	        	//alert('111 channel=' + channel )
	        	
	            window.bridge = channel.objects.bridge;
	            alert('bridge='+bridge+'\n从pyqt传来的参数=' + window.bridge.strValue ) ;
	            
	        });
        });
        
	      function onShowMsgBox() {
	        //alert('window.bridge=' + window.bridge);
	        
	        if ( window.bridge) {
	        	//alert('bridge.strValue=' + window.bridge.strValue ) ;
	            //bridge.sayHello('999')
	            var fname = document.getElementById('fname').value;
	            window.bridge.strValue = fname;
	            
	            
	        }
        	
        }
	          
      
      </script>     
    </head>

    <body>
      <form>
        <label for="姓名">user name:</label>
        <input type="text" name="fname" id="fname"></input>
        <br />
        <input type="button" value="传递参数到pyqt" onclick="onShowMsgBox()">
        <input type="reset" value='重置'/>
      </form>
    </body>
  </html>